{extend name="v1/layout/base"}
{block name="content"}
<div class="layui-row layui-col-space15">
  <div class="layui-col-md12">
    <form class="layui-card-body layui-form layui-form-pane">
      <!-- 需要购买的物品 -->
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">基础信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">主单号：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.order_sn}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">订单编号：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.sub_order_sn}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">订单状态：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.status_txt}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">支付方式：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.pay_type}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">支付状态：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.pay_status}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">收货人信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">姓名：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.name}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">电话：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.tel}" class="layui-input">
          </div>
        </div>
      </div>
      {if condition="$info['shipping_type'] eq 1"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">收货地址：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" value="{$info.province}{$info.city}{$info.area}{$info.address}" lay-verify="required" autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">产品信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <table class="layui-table " lay-size="lg">
            <thead>
              <tr>
                <th>产品名称</th>
                <th>产品单价</th>
                <th>购买数量</th>
                <th>产品规格</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              {volist name="$info.orderGoods" id="vo"}
              <tr>
                <td>{$vo.goods_name}</td>
                <td>{$vo.goods_price}</td>
                <td>{$vo.buy_num}</td>
                <td>{$vo.spec_value}</td>
                <td>
                {switch name="$vo['status']"}
                  {case value="0.1"}待支付{/case}
                  {case value="1.1"}待发货{/case}
                  {case value="2.1"}待收货{/case}
                  {case value="3.1"}已收货{/case}
                  {case value="4.1"}已评价{/case}
                  {case value="5.1"}申请退款中{/case}
                  {case value="5.11"}退款中{/case}
                  {case value="5.12"}退款拒绝{/case}
                  {case value="5.13"}退款完成{/case}
                  {case value="5.14"}退款异常{/case}
                  {case value="5.2"}申请退货中{/case}
                  {case value="5.21"}等待买家填写物流{/case}
                  {case value="5.22"}拒绝退货{/case}
                  {case value="5.23"}等待买家发货{/case}
                  {case value="5.24"}收货执行退款中{/case}
                  {case value="5.25"}退货成功{/case}
                  {case value="5.26"}退货异常{/case}
                  {case value="6.1"}已取消{/case}
                  {default /}正常进行
                {/switch}
                </td>
              </tr>
              {/volist}
            </tbody>
          </table>
        </div>
      </div>
      {if condition="$info['delivery_time'] && $info['shipping_type'] == 1"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">物流信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">物流单号：</label>
          <div class="layui-input-block">
            <input type="text" name="company_num" disabled="disabled"  autocomplete="off" value="{$info.company_num}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      <!-- 财务信息 -->
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">财务信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg4">
          <label class="layui-form-label">商品总价：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.total_price}" class="layui-input">
          </div>
        </div>
        <div class="layui-col-lg4">
          <label class="layui-form-label">运费：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.total_freight}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">订单总价：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.all_price}" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg4">
          <label class="layui-form-label">需付款：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.need_pay}" class="layui-input">
          </div>
        </div>
        <div class="layui-col-lg4">
          <label class="layui-form-label">实付款：</label>
          <div class="layui-input-block">
            {if condition="$info.pay_status == 1"}
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.need_pay}" class="layui-input">
            {else /}
            <input type="text" disabled="disabled" autocomplete="off" value="0" class="layui-input">
            {/if}
          </div>
        </div>
      </div>

      <!-- 时间线 -->
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">时间信息
          <hr class="layui-border-red">
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">订单创建时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.create_time}" class="layui-input">
          </div>
        </div>
      </div>
      {if condition="$info['pay_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">付款时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.pay_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      {if condition="$info['cancel_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">订单取消时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.cancel_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      {if condition="$info['delivery_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">发货时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.delivery_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      {if condition="$info['receiving_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">收货时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.receiving_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      {if condition="$info['evaluation_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">评价时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.evaluation_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      {if condition="$info['delete_time']"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">删除时间：</label>
          <div class="layui-input-block">
            <input type="text" disabled="disabled" autocomplete="off" value="{$info.delete_time}" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8" style="color:#000;text-align: center;">
          <hr class="layui-border-red">操作
          <hr class="layui-border-red">
        </div>
      </div>

      <!-- 修改订单状态订单改价  -->

      <!-- 底部操作按钮 -->
      <div class="layui-row">
        <div class="layui-col-xs2">&nbsp;</div>
        <div class="layui-col-xs5">
          <input type="hidden" name="sub_order_sn" value="{$info.sub_order_sn}">
          <button type="button" class="layui-btn layui-btn-primary layui-btn-radius" id="backList"><i class="layui-icon">&#xe65c;</i>返回列表</button>
        </div>
        <div class="layui-col-xs5">&nbsp;</div>
      </div>
      <!-- 底部操作按钮结束 -->
    </form>
  </div>
</div>
{/block}
{block name="myScript"}
<style>
  .oshow_logistics {
  background: #fff;
  padding: 15px 30px 30px 35px;
}

.logistics_title {
  font-size: 16px;
  color: #000000;
}

.oshow_logistics ul {
  margin-top: 18px;
}

.oshow_logistics ul::-webkit-scrollbar {
  width: 8px;
  height: 1px;
}

.oshow_logistics ul::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: #f87924;
}

.oshow_logistics ul::-webkit-scrollbar-track {
  border-radius: 8px;
  background: #e5e5e5;
}

.oshow_logistics li {
  display: flex;
  min-height: 72px;
}

.logistics_time {
  width: 185px;
  font-size: 14px;
  line-height: 20px;
  color: #666;
  padding-top: 3px;
  padding-right: 20px;
}

.logistics_hr {
  width: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logistics_hr img {
  width: 25px;
  height: 25px;
}

.logistics_hr span {
  flex: 1;
  overflow: hidden;
  border-right: 1px solid #d7d7d7;
}

.logistics_text {
  flex:1;
  overflow: hidden;
  padding-bottom: 30px;
  padding-top: 3px;
  font-size: 16px;
  line-height: 22px;
  color: #666666;
}

.logistics_active .logistics_time,
.logistics_active .logistics_text {
  color: #1a74fa;
}

.oshow_logistics li:last-of-type {
  min-height: auto;
}

.oshow_logistics li:last-of-type .logistics_hr span {
  display: none;
}

.oshow_logistics li:last-of-type .logistics_text {
  padding-bottom: 0;
}
</style>
<script>
  layui.use(['form'], function() {
    var form = layui.form,
      layer = layui.layer,
      $ = layui.$;
    form.on('submit(doDelivery)',function(data){
      var sub_order_sn = '{$info.sub_order_sn}',
          url = "/{:config("manage.manage_name")}/{:config("manage.version")}/Order/getOrderGoods/sub_order_sn/"+sub_order_sn;
          var index = layer.open({
            title: '订单编号：' + sub_order_sn + '发货处理',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['100%', '100%'],
            content: url,
            cancel: function() {

            }
          });
    })
    form.on('submit(doPay)', function(data) {
      var need_pay = '{$info.need_pay}',
          html = '<div class="layui-row layui-col-space15"><div class="layui-col-md12"><div class="layui-card-body layui-form layui-form-pane"><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">实际打款金额：</label><div class="layui-input-block"><input type="text" id="pay_price" autocomplete="off" value="'+need_pay+'" class="layui-input"></div></div></div><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">打款流水：</label><div class="layui-input-block"><input type="text" id="pay_code" autocomplete="off" value="" class="layui-input"></div></div></div></div></div></div>';
      //询问框
      layer.open({
        type: 1,
        title: '后端确认付款',
        shadeClose: true,
        shade: true,
        maxmin: true,
        area: ['800px', '400px'],
        btn: ['确认', '取消'],
        content: html,
        success: function(layero, index) {

        },
        yes: function(index, layero) {
          var pay_price = $("#pay_price").val(),
              pay_code = $("#pay_code").val(),
              sub_order_sn = '{$info.sub_order_sn}',
              url = "/{:config("manage.manage_name")}/{:config("manage.version")}/Order/doPay";
          https(url,{pay_price: pay_price,pay_code:pay_code,sub_order_sn:sub_order_sn},'post',1,'正在执行付款').then(res=>{
              xkInfoMsg(res.result_msg);
          })
        },
        btn2: function() {
          //alert("222");  取消时触发
        }
      });
    });
    form.on('submit(searchShipping)', function(data) {
      var  company_num = '{$info.company_num}',
          url = "/{:config("manage.manage_name")}/{:config("manage.version")}/Order/searchShipping"
      https(url,{company_num: company_num},'post',0,'查询物流数据').then(res=>{
          if(res.resultData.length > 0){
            var html = '<div class="oshow_logistics"><ul>';
                res.resultData.forEach((item, i) => {
                   html += '<li><div class="logistics_time"><div>'+item.time+'</div></div><div class="logistics_text">'+item.content+'</div></li>';
                });
                html += '</ul></div>';
            var index = layer.open({
              type: 1,
              title: '查询物流',
              shadeClose: true,
              shade: 0.2,
              maxmin: true,
              area: ['800px', '400px'],
              content: html,
              success: function(layero, index) {
              },
              yes: function(index, layero) {
              },
              btn2: function() {

              }
            });
          }else{
            xkInfoMsg("暂无物流数据");
          }
      })
    });
    form.on('submit(chanageAddress)', function(data) {
      var name = '{$info.name}',
          tel = '{$info.tel}',
          province = '{$info.province}',
          city = '{$info.city}',
          area = '{$info.area}',
          address = '{$info.address}';
      var html = '<div class="layui-row layui-col-space15"><div class="layui-col-md12"><div class="layui-card-body layui-form layui-form-pane"><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">姓名：</label><div class="layui-input-block"><input type="text" value="'+name+'" id="name" autocomplete="off" class="layui-input"></div></div></div> <div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">电话：</label><div class="layui-input-block"><input type="text" value="'+tel+'" id="tel" autocomplete="off" class="layui-input"></div></div></div> <div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">省：</label><div class="layui-input-block"><input type="text" value="'+province+'" id="province" autocomplete="off" class="layui-input"></div></div></div> <div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">市：</label><div class="layui-input-block"><input type="text" value="'+city+'" id="city" autocomplete="off" class="layui-input"></div></div></div> <div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">区/县：</label><div class="layui-input-block"><input type="text" value="'+area+'" id="area" autocomplete="off" class="layui-input"></div></div></div> <div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">地址：</label><div class="layui-input-block"><input type="text" value="'+address+'" id="address" autocomplete="off" class="layui-input"></div></div></div> </div></div></div>';
      //询问框
      layer.open({
        type: 1,
        title: '修改地址',
        shadeClose: true,
        shade: false,
        maxmin: true,
        area: ['800px', '600px'],
        btn: ['确认', '取消'],
        content: html,
        success: function(layero, index) {

        },
        yes: function(index, layero) {
          var name = $("#name").val(),
              tel = $("#tel").val(),
              province = $("#province").val(),
              city = $("#city").val(),
              area = $("#area").val(),
              address = $("#address").val(),
              sub_order_sn = '{$info.sub_order_sn}',
              url = "/{:config("manage.manage_name")}/{:config("manage.version")}/Order/chanageAddress";
          https(url,{name: name,sub_order_sn:sub_order_sn,tel:tel,province:province,city:city,area:area,address:address},'post',1,'正在执行地址调整修改').then(res=>{
              xkInfoMsg(res.result_msg);
          })
        },
        btn2: function() {
          //alert("222");  取消时触发
        }
      });
    });
    form.on('submit(doSelfMakeSure)', function(data) {
      var html = '<div class="layui-row layui-col-space15"><div class="layui-col-md12"><div class="layui-card-body layui-form layui-form-pane"><div class="layui-row layui-col-space12 layui-form-item"><div class="layui-col-lg8"><label class="layui-form-label">核销码：</label><div class="layui-input-block"><input type="text" id="self_code_no" autocomplete="off" value="" class="layui-input"></div></div></div></div></div></div>';
      //询问框
      layer.open({
        type: 1,
        title: '后端核销自提订单',
        shadeClose: true,
        shade: 0.2,
        maxmin: true,
        area: ['800px', '400px'],
        btn: ['确认', '取消'],
        content: html,
        success: function(layero, index) {

        },
        yes: function(index, layero) {
          var self_code_no = $("#self_code_no").val(),
              sub_order_sn = '{$info.sub_order_sn}',
              url = "/{:config("manage.manage_name")}/{:config("manage.version")}/Order/doSelfMakeSure";
          https(url,{self_code_no: self_code_no,sub_order_sn:sub_order_sn},'post',1,'正在执行订单核销').then(res=>{
              xkInfoMsg(res.result_msg);
          })
        },
        btn2: function() {
          //alert("222");  取消时触发
        }
      });
    });
    $('.fangda').click(function(){
      var abcccc=$(this)
      layer.open({
        type: 1,
        title: false,
        closeBtn: 0,
        area: ['auto'],
        skin: 'layui-layer-nobg', //没有背景色
        shadeClose: true,
        content: abcccc
      });
    })
    $(".doCheckReturnRefund").click(function(){
      var sub_order_sn = $(this).attr('data-sub_order_sn'),
          order_goods_id = $(this).attr('data-order_goods_id');
          url = "/{:config("manage.manage_name")}/{:config("manage.version")}/Order/orderRefundShow/sub_order_sn/"+sub_order_sn+"/order_goods_id/"+order_goods_id;
          var index = layer.open({
            title: '订单编号：' + sub_order_sn + '售后处理',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['100%', '100%'],
            content: url,
            cancel: function() {

            }
          });
    })
  });

</script>
{/block}
